﻿using System;
using System.Web.Mvc;
using Sharp.Infrastructure.Communication;
using Sharp.Platform.Mvc;
using Sharp.ServiceContracts;
using Sharp.WebBooter.Areas.CMS.Models;

namespace Sharp.WebBooter.Areas.CMS.Controllers
{
    [AutomaticTemplate]
    public class UserLogController : Controller
    {
        [HttpGet]
        
        public ActionResult Index()
        {
            return View(new UserLogIndexViewModel());
        }

        [HttpPost]
        public ActionResult GetPaged(DataTableParameter param)
        {
            using (var proxy = new ServiceProxy<IUserService>())
            {
                var page = proxy.Channel.GetUserLogPaged(param.ToPagingFeature());

                return Content(page.ToReturnedData().ToJson());
            }
        }
        [HttpPost]
        [Permission(Name = "删除", Order = 0)]
        public ActionResult Delete(Guid[] ids)
        {
            using (var proxy = new ServiceProxy<IUserService>())
            {
                var res = proxy.Channel.DeleteUserLogs(ids);
                return this.JsonNet(res);
            }
        }
    }
}
